﻿using System;
using UnityEngine;

// 声明必须拥有Rigidbody2D组件
[RequireComponent(typeof(Rigidbody2D))]
public class Spaceship : MonoBehaviour
{
	// 移动速度
	public float speed;
	
	// 攻击间隔
	public float shotDelay;
	
	// 子弹Prefab
	public GameObject bullet;

	// 爆炸特效游戏对象
	public GameObject explosion;


	private Animator anime;
	

	void Start() {
		anime = GetComponent<Animator>();
	}
	
	// 生成子弹
	public void Shot (Transform origin)
	{
		Instantiate (bullet, origin.position, origin.rotation);
	}
	

    public void PlayExplosion()
    {
		// 生成爆炸特效
       Instantiate (explosion, transform.position, transform.rotation);;
    }

	    // 获取动画的方法
    public Animator GetAnimator()
    {
        return anime;
    }
}